{% extends 'bookmanage/base.html' %}

{% block content %}

    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading">作者列表</div>
        <div class="panel-body pull-right">
            <a class="btn btn-primary" href="{% url 'auther_add' %}" role="button">新增</a>
        </div>

        <!-- Table -->
        <table class="table table-bordered table-hover">
            <tr>
                <th>id</th>
                <th>姓名</th>
                <th>住址</th>
                <th>邮箱</th>
                <th>电话</th>
                <th>编辑</th>
            </tr>
            {% for auther in auther_list %}
                <tr>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ auther.name }}</td>
                    <td>{{ auther.address }}</td>
                    <td> {{ auther.autherdetail.phone }}</td>
                    <td> {{ auther.autherdetail.email }} </td>
                    <td>
                        <a href="{% url 'auther_change' id=auther.id %}">修改</a>
                        <a href="{% url 'auther_delete' id=auther.id %}">删除</a>
                    </td>
                </tr>
            {% empty %}
                <tr>
                    <td colspan="7">暂无最新数据，请先添加</td>
                </tr>
            {% endfor %}
        </table>
    </div>

    <script>
        $(".book_list").removeClass("active")
        $(".auth_list").addClass("active")
        $(".pub_list").removeClass("active")
    </script>

{% endblock %}
